package com.usa.tool.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usa.tool.entity.UserLoginLog;
import com.usa.tool.model.AuditLoginLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 *
 * @author YueGod
 * @since 2023/10/7
 */
public interface UserLoginLogMapper extends BaseMapper<UserLoginLog> {

	@Select("select distinct t3.login_id,\n" + "                t1.account_id,\n" + "                t1.create_ip,\n" + "                t2.position_num,\n" + "                t2.country,\n" + "                t2.country_iso,\n" + "                t2.state,\n" + "                t2.county,\n" + "                t2.longitude,\n" + "                t2.latitude\n" + "from tb_user_login_log t1\n" + "         left join tb_user_position t2 on t2.account_id = t1.account_id\n" + "         left join tb_user_info t3 on t3.account_id = t1.account_id\n" + "where 1 = 1\n" + "  and t2.country_iso != 'CHN'\n" + "  and t3.login_id in\n" + "      ('3600608059', '6250210515', '9010001470', '9170201917', '3165386902', '5863823964', '4973232350', '6472835920',\n" + "       '6383291640', '9127368362', '8241795327')\n" + "order by login_id,create_ip,longitude,latitude desc;\n" + "\n" + "select t1.* from tb_order t1\n" + "left join tb_user_info t2 on t2.account_id = t1.account_id\n" + "where t2.login_id = '1760006858'")
	List<AuditLoginLog> findAuditLoginLog();

	@Select("select distinct account_id from tb_user_login_log where create_ip like #{createIp}")
	List<UserLoginLog> findByCreateIpLike(@Param("createIp") String createIp);
}
